//
//  config.h
//  Stock_Pro
//
//  Created by imuse on 10-11-18.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "XmlTools.h"
#import <UIKit/UIKit.h>

/************************************************************************/
/*								客户端版本相关								*/
/************************************************************************/
#define APP_VER				"ax_iphone_ax01_2.0.0.1_023"//"安信iphone_1.0.0.1"

/************************************************************************/
/*								交易多帐户保存							*/
/************************************************************************/
#define TRADE_LOGIN_ACCOUNTS	@"accountListTag"

/************************************************************************/
/*								应用配置相关								*/
/************************************************************************/
#define CONFIG_HOST			"host"				//用户选择主站ip
#define CONFIG_LAYOUT		"layout"			//布局
#define CONFIG_USER_ID		"userid"			//港澳用户id(用于l2行情)
#define CONFIG_QS_USER_ID	"qsuserid"			//券商用户id
#define CONFIG_USER_CERT	"cert"				//获取证书信息
#define CONFIG_USER_PHONE	"mobile"			//用户手机号码
#define CONFIG_SESSION_ID	"sessionid"			//
#define CONFIG_QS_SESSION_ID    "qssessionid"       //券商session
#define CONFIG_LEVE			"leve"				//级别id
#define CONFIG_AUTO_SEL_SER	"autoselser"		//是否自动测速 
#define CONFIG_SEV_LIST_VER	"SevLstVer"			//服务器地址版本号
#define CONFIG_CODE_VER		"CodeVer"			//代码表版本号
//#define	CONFIG_APP_VER		"IP002"				//当前应用程序内部版本号，用做升级控制
#define CONFIG_CUR_VER		"curver"			//当前版本
#define CONFIG_TRADE_LOCK	"TradeLock"		//交易锁屏设置

#define CONFIG_MA1  "MA1"  //K线MA值修改
#define CONFIG_MA2  "MA2"
#define CONFIG_MA3  "MA3"
#define CONFIG_MA4  "MA4"

#define CONFIN_INFOAPI "infoapi"
#define CONFIN_TRADEAPI "tradeapi"

void ReadConfig();
void FreeConfig();
void SaveConfig();
void AddConfig(char *pTag, char *pVar);
char* GetConfig(char *pTag);

#define CONFIG_XML_SIZE 15360

char*	ReadConfigLayoutXml();

#define CONFIG_XML ReadConfigLayoutXml()

void AutoConfigLayout(UIView *uiView, XML_NODE *pNode, char *pViewName, int nMode);

/************************************************************************/
/*								板块配置相关								*/
/************************************************************************/
void ReadBlackData();
void FreeBlackData();
XML_NODE* GetXmlNodeBlack();

/************************************************************************/
/*								服务地址相关								*/
/************************************************************************/
#define URL_F10			"F10"			/*个股财务数据(F10)*/
#define URL_HELP		"Help"			/*在线帮助*/
#define URL_QUOTE		"Quote1"			/*行情*/
#define URL_TRADE		"Trade"			/*交易*/
#define URL_INFOR		"Info"			/*资讯*/
#define URL_HEADLINE	"Headline"		/*今日头条*/
#define URL_MYFEED		"MyFeed"		/*我的订阅*/
#define URL_MYSELINFO	"MySelInfo"		/*我的自选股sh相关信息*/
#define URL_SERVICE		"ServiceCenter"	/*服务中心*/
#define URL_MYSPACE		"MySpace"		/*我的空间*/
#define URL_FUND		"FundMarket"	/*基金地址*/
#define URL_QSFUND		"QsFundMarket"	/*券商基金地址*/
#define URL_BROKER		"Trade"		/*交易列表*/
#define URL_VIDEO		"Video"			/*视频*/
#define URL_TABLEINFO	"TableInfo"		/*表格数据，期货*/
#define URL_UP_DOWN_OWN	"UserSelAccess"	/*上传下载自选*/
#define URL_ACCOUNT_ANALYSIS	"PositionAnalysis"		/*账户诊断*/
#define URL_STOCK_RESEARCH		"StockResearch"			/*研究*/
#define URL_CHANGE_USER			"Login"					/*切换用户*/
#define URL_NOTICE				"Notice"				/*首页小信封*/
#define URL_FINISH_APPLE_TRANS	"FinishAppleTrans"		/*记费成功后提交认证地址*/
#define URL_LOGO_MSG			"LogoMsg"				/*首页logo请求地址*/
#define URL_OPENNAV				"OpenNav"		/*历史净值图*/
#define URL_QSOPENNAV			"QsOpenNav"		/*券商历史净值图*/

#define URL_AUTH_LOGIN	"AuthLogin"		/*用户每次登陆自动认证*/
#define URL_AUTH_REG	"AutoReg"		/*用户注册*/
#define URL_LOGOUT		"Logout"		/*用户退出程序*/
#define URL_LOGIN		"Login"			/*用户手动登录（切换用户）*/
#define URL_FIND_PASS	"FindPass"		/*用户忘记密码*/

#define URL_QS_REG	"QSActiveReg"		/*券商注册页面*/
#define URL_QS_ACT	"QSActivate"		/*券商注册激活*/
#define URL_QS_UP_DOWN_OWN	"QSUserSelAccess"	/*券商上传下载自选*/

#define URL_GLOBAL		"TableInfo"		/*全球市场地址*/

#define URL_LEVE2_INDEX_HELP    "Level2Help"

#define URL_FUND_AX		"TableInfo2"	/*安信理财*/

#define URL_HISTORYNAV	"HistoryNav"		/*历史净值图*/

#define URL_CLASS		"FinancialClass"	/*理财课堂*/

#define URL_FUNDINFO	"EndFundInfo"		/*开放基金资讯列表*/

#define URL_ONLINE_EXPERT	"OnlineExpert"		/*专家在线*/
#define URL_VIDEO_PLAY	"VideoBroadcast"		/*视频播放*/

#define URL_FEEDBACK	"Feedback"		/*用户反馈*/

#define URL_FUNDCOMPARE "FundCompare" /*基金对比*/
#define URL_FUNDFILTER "FundFilter" /*基金筛选*/

#define URL_STOCKALERT "StockAlert" /*预警地址*/

#define URL_REVACCOUNT  "RevAccount"
#define URL_FINANCIALCLASS  "FinancialClass"

#define URL_PHONEACCOUNT  "PhoneAccount_IOS"  /*手机开户*/
#define URL_MOBILESTORE  "MobileStore"    /*移动商城*/
#define URL_XIAODAITONG "xiaodaitong" /*小贷通*/

#define URL_RISKAGREEMENT   "RiskAgreement"  /*风险协议书*/
#define URL_OPENINGAGREEMENT   "OpeningAgreement"  /*开通协议书*/

#define URL_FINDINFO   "Find"       /*发现功能*/
#define URL_STOCKINFO  "StockInfo"  /*个股资讯*/
#define URL_BDZQ       "bdzq"  /*标的证券*/

#define URL_UPDATE   "UpdateUrl_IOS"    /*应用升级地址*/
#define APP_ID       "APP_IOS_ID"    /*应用ID*/

//lisz 20111123 add start
#define URL_PUSH_REG        "SavePushAccount"
//lisz 20111123 add end
//add by jason push推送动作解析标签
#define URL_PUSH_TAG				"NewsJump"		//push动作
#define URL_PUSH_TRADE			"SaveUseridAccount"
#define URL_Disclaimer      "Disclaimer"
//成交回报订阅标签
#define URL_SUB_BIND        "SubscribeBind"
#define URL_SUB_APPLY       "SubscribeApply"
#define URL_SUB_VERIFY      "SubscribeSmsVerify"
#define URL_STOCK_DIAGNOSIS "StocksDiagnosis"   //个股诊断
#define URL_NEWS_FLASH      "NewsFlash"         //我的定制
//end

#define URL_MADENG		      "NewMaDeng"		/*跑马灯*/

#define CONFIG_THEME      "theme"

#define IPHONE5 (MAX([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) >= 568)

//判断是否是iphone4设备 xiezm 20130402 add start
#define IPHONE4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

//判断是否ios7及更高系统版本
//#define IOS7_OR_LATER ([[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedAscending)
#define IOS7_OR_LATER [[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0
#define TITLE_BAR_HEIGHT  25
// fmy 14.9.18
//#define IOS8_OR_LATER ([[[UIDevice currentDevice] systemVersion] compare:@"8.0"] != NSOrderedAscending)
#define IOS8_OR_LATER [[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0

#define NATIVE_VERSION 1 //原生1 H5 0

enum URL_TYPE_tag
{
	URL_TYPE_LEVE1 = 0,	/*leve one server url*/
	URL_TYPE_LEVE2,		/*leve tow server url*/
};

void ReadServerUrl();
void FreeServerUrl();

/*
 调用后请，主动释放返回内容
 获取url
 */
char* GetUrl(char *pTag, int nType);
/*
 调用后请，主动释放返回内容
 获取当前行情ip
 */
char* GetQuoteIP(char *pTag, int nType);
/*
 调用后请，主动释放返回内容
 获取所有行情站点
 */
ROW_NODE* GetUrlNode(char *pTag);

/*
 向传处的url后面添加user,session,appver信息
 */
void UrlAddUserInfo(char* pUrl);

